#ifndef LOGINFORM_H
#define LOGINFORM_H

#include <QWidget>
#include <QPixmap>
#include <QResizeEvent>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QSqlRecord>
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QKeyEvent>
#include "registerform.h"

#include <QDateTime>
#include <QDebug>
#include <cstdlib> // For rand()
#include <ctime>   // For seeding rand()
#include <QThread>

namespace Ui {
class LoginForm;
}

class LoginForm : public QWidget
{
    Q_OBJECT

public:
    explicit LoginForm(QWidget *parent = 0);
    ~LoginForm();
protected:
    void resizeEvent(QResizeEvent *event) override;
    void Init_Login();
    void open_database();
private slots:
    void on_usernameedit_returnPressed();

    void on_passwordedit_returnPressed();

    void check_login();




    void on_signuppushButton_pressed();

    void on_signinpushButton_pressed();

    void generateAndInsertData();

public:
    Ui::LoginForm *ui;
    QPixmap pixmap;
    QPixmap img;
    void updateLabelPixmap();


    QSqlDatabase    db;
    QString         filename;
    QStringList     names;
    QStringList     passwords;

    QString username;
    QString password;

    bool eventFilter(QObject *watched, QEvent *event);
};

#endif // LOGINFORM_H
